package com.coocaa.ops.api.v1.content.service.impl;

import com.alibaba.fastjson.JSON;
import com.coocaa.ops.api.common.model.HeaderModel;
import com.coocaa.ops.api.v1.content.model.query.TabQueryModel;
import com.coocaa.ops.api.v1.content.model.output.TabContent;
import com.coocaa.ops.api.v1.content.service.ITabService;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * 测试用，使用假数据
 * @author tangminghong
 * @date 2020-06-24
 */
@Service("tabServiceTest")
public class TabServiceTestImpl implements ITabService {

    /**
     * 获取版面内容
     *
     * @param header      请求头
     * @param tabQueryModel 传入参数
     * @return 版面内容
     */
    @Override
    public TabContent getTabContent(HeaderModel header, TabQueryModel tabQueryModel) {
        if (Objects.equals(tabQueryModel.getTabId(), "1") || Objects.equals(tabQueryModel.getTabId(), "2")) {
            TabContent tabContent = JSON.parseObject(tabContenJson, TabContent.class);
            return tabContent;
        }
        return null;
    }

    private static final String tabContenJson = "{\n" +
            "  \"tab\": {\n" +
            "    \"contents\": [\n" +
            "      {\n" +
            "        \"bg\": \"\",\n" +
            "        \"contents\": [\n" +
            "          {\n" +
            "            \"extra\": {\n" +
            "              \"block_title\": {\n" +
            "                \"sub_title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"最强终结者最后的战场  “I won’t be back”再见，T800\"\n" +
            "                },\n" +
            "                \"title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"终结者：黑暗命运\"\n" +
            "                }\n" +
            "              },\n" +
            "              \"block_content_info\": {\n" +
            "                \"imgs\": {\n" +
            "                  \"corner_icons\": [\n" +
            "                    \n" +
            "                  ],\n" +
            "                  \"poster\": {\n" +
            "                    \"images\": [\n" +
            "                      \"http://img.sky.fs.skysrt.com/tvos6_imgs_master/20200426/20200426162900853261_1760*326.jpg\"\n" +
            "                    ]\n" +
            "                  }\n" +
            "                },\n" +
            "                \"action\": \"{\\\"packagename\\\" :\\\"com.tianci.movieplatform\\\",\\\"versioncode\\\" : \\\"\\\",\\\"bywhat\\\" : \\\"action\\\",\\\"byvalue\\\" : \\\"coocaa.intent.movie.detailinfo\\\",\\\"dowhat\\\" : \\\"startActivity\\\",\\\"params\\\" : {\\\"id\\\" : \\\"_oqy_1747158800\\\"},\\\"exception\\\" : \\\"\\\"}\",\n" +
            "                \"title\": \"终结者：黑暗命运\"\n" +
            "              },\n" +
            "              \"block_type_info\": {\n" +
            "                \"lucency_flag\": \"0\"\n" +
            "              },\n" +
            "              \"params\": \"{}\",\n" +
            "              \"vector_tag_flag\": 0,\n" +
            "              \"normal_special_flag\": 1\n" +
            "            },\n" +
            "            \"width\": 1760,\n" +
            "            \"x\": 0,\n" +
            "            \"y\": 0,\n" +
            "            \"focusable\": 1,\n" +
            "            \"id\": \"101772560\",\n" +
            "            \"type\": \"Block\",\n" +
            "            \"height\": 300\n" +
            "          },\n" +
            "          {\n" +
            "            \"extra\": {\n" +
            "              \"block_title\": {\n" +
            "                \"sub_title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"007大破上流谋杀案\"\n" +
            "                },\n" +
            "                \"title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"利刃出鞘\"\n" +
            "                }\n" +
            "              },\n" +
            "              \"block_content_info\": {\n" +
            "                \"imgs\": {\n" +
            "                  \"corner_icons\": [\n" +
            "                    \n" +
            "                  ],\n" +
            "                  \"focus_img_url\": \"\",\n" +
            "                  \"poster\": {\n" +
            "                    \"images\": [\n" +
            "                      \"http://pic0.iqiyipic.com/image/20200430/fe/ae/v_123086784_m_601_m19_480_270.jpg\"\n" +
            "                    ]\n" +
            "                  }\n" +
            "                },\n" +
            "                \"action\": \"{\\\"packagename\\\" :\\\"com.tianci.movieplatform\\\",\\\"versioncode\\\" : \\\"\\\",\\\"bywhat\\\" : \\\"action\\\",\\\"byvalue\\\" : \\\"coocaa.intent.movie.detailinfo\\\",\\\"dowhat\\\" : \\\"startActivity\\\",\\\"params\\\" : {\\\"id\\\" : \\\"_oqy_1747232700\\\"},\\\"exception\\\" : \\\"\\\"}\",\n" +
            "                \"title\": \"利刃出鞘\"\n" +
            "              }\n" +
            "            },\n" +
            "            \"width\": 560,\n" +
            "            \"x\": 0,\n" +
            "            \"y\": 340,\n" +
            "            \"focusable\": 1,\n" +
            "            \"id\": \"101772561\",\n" +
            "            \"type\": \"Block\",\n" +
            "            \"height\": 300\n" +
            "          },\n" +
            "          {\n" +
            "            \"extra\": {\n" +
            "              \"block_title\": {\n" +
            "                \"sub_title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"捷德奥特曼剧场版 普通话版\"\n" +
            "                },\n" +
            "                \"title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"捷德奥特曼剧场版 连接吧！心愿！！ 普通话版\"\n" +
            "                }\n" +
            "              },\n" +
            "              \"block_content\": {\n" +
            "                \"imgs\": {\n" +
            "                  \"corner_icons\": [\n" +
            "                    \n" +
            "                  ],\n" +
            "                  \"focus_img_url\": \"\",\n" +
            "                  \"poster\": {\n" +
            "                    \"images\": [\n" +
            "                      \"http://pic4.iqiyipic.com/image/20180311/00/9e/v_115152235_m_601_480_270.jpg\"\n" +
            "                    ]\n" +
            "                  }\n" +
            "                },\n" +
            "                \"action\": \"{\\\"packagename\\\" :\\\"com.tianci.movieplatform\\\",\\\"versioncode\\\" : \\\"\\\",\\\"bywhat\\\" : \\\"action\\\",\\\"byvalue\\\" : \\\"coocaa.intent.movie.detailinfo\\\",\\\"dowhat\\\" : \\\"startActivity\\\",\\\"params\\\" : {\\\"id\\\" : \\\"_oqy_957392000\\\"},\\\"exception\\\" : \\\"\\\"}\",\n" +
            "                \"title\": \"捷德奥特曼剧场版 连接吧！心愿！！ 普通话版\"\n" +
            "              }\n" +
            "            },\n" +
            "            \"width\": 560,\n" +
            "            \"x\": 600,\n" +
            "            \"y\": 340,\n" +
            "            \"focusable\": 1,\n" +
            "            \"id\": \"101772562\",\n" +
            "            \"type\": \"Block\",\n" +
            "            \"height\": 300\n" +
            "          },\n" +
            "          {\n" +
            "            \"extra\": {\n" +
            "              \"block_new_title_info\": {\n" +
            "                \"sub_title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"猫和老鼠 高清版\"\n" +
            "                },\n" +
            "                \"title\": {\n" +
            "                  \"show\": 0,\n" +
            "                  \"text\": \"猫和老鼠 高清版\"\n" +
            "                }\n" +
            "              },\n" +
            "              \"block_content\": {\n" +
            "                \"imgs\": {\n" +
            "                  \"corner_icons\": [\n" +
            "                    \n" +
            "                  ],\n" +
            "                  \"focus_img_url\": \"\",\n" +
            "                  \"poster\": {\n" +
            "                    \"images\": [\n" +
            "                      \"http://pic3.iqiyipic.com/image/20181012/ae/49/a_100007979_m_601_m3_480_270.jpg\"\n" +
            "                    ]\n" +
            "                  }\n" +
            "                },\n" +
            "                \"media_info\": {\n" +
            "                  \"score\": \"7.7\",\n" +
            "                  \"variety\": \"\",\n" +
            "                  \"series\": 0,\n" +
            "                  \"id\": \"_oqy_202246601\",\n" +
            "                  \"type\": \"anime\",\n" +
            "                  \"publish_status\": \"unknown\"\n" +
            "                },\n" +
            "                \"action\": \"{\\\"packagename\\\" :\\\"com.tianci.movieplatform\\\",\\\"versioncode\\\" : \\\"\\\",\\\"bywhat\\\" : \\\"action\\\",\\\"byvalue\\\" : \\\"coocaa.intent.movie.detailinfo\\\",\\\"dowhat\\\" : \\\"startActivity\\\",\\\"params\\\" : {\\\"id\\\" : \\\"_oqy_202246601\\\"},\\\"exception\\\" : \\\"\\\"}\",\n" +
            "                \"title\": \"猫和老鼠 高清版\"\n" +
            "              }\n" +
            "            },\n" +
            "            \"width\": 560,\n" +
            "            \"x\": 1200,\n" +
            "            \"y\": 340,\n" +
            "            \"focusable\": 1,\n" +
            "            \"id\": \"101772563\",\n" +
            "            \"type\": \"Block\",\n" +
            "            \"height\": 300\n" +
            "          }\n" +
            "        ],\n" +
            "        \"extra\": {\n" +
            "          \"panel_id\": \"1\",\n" +
            "          \"panel_name\": \"预置板块1\",\n" +
            "          \"panel_version\": \"1\",\n" +
            "          \"title\": {\n" +
            "            \"text\": \"预置板块1\"\n" +
            "          }\n" +
            "        },\n" +
            "        \"focusable\": 0,\n" +
            "        \"height\": 0,\n" +
            "        \"id\": \"1\",\n" +
            "        \"parents\": \"\",\n" +
            "        \"type\": \"Panel\",\n" +
            "        \"width\": 0,\n" +
            "        \"x\": 0,\n" +
            "        \"y\": 0\n" +
            "      }\n" +
            "    ],\n" +
            "    \"extra\": {\n" +
            "      \"orientation\": 1,\n" +
            "      \"space\": 40,\n" +
            "      \"titlle\": null\n" +
            "    },\n" +
            "    \"height\": 0,\n" +
            "    \"id\": \"\",\n" +
            "    \"parents\": \"\",\n" +
            "    \"type\": \"Expander\",\n" +
            "    \"width\": 0,\n" +
            "    \"x\": 0,\n" +
            "    \"y\": 0\n" +
            "  },\n" +
            "  \"type\": \"Normal\",\n" +
            "  \"total\": 1,\n" +
            "  \"extra\": null\n" +
            "}";
}
